//
//  CommonFunction.h
//  SaySomething
//
//  Created by Edward Zhang on 12-4-3.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JddPickerView.h"
#import "JddShuangSeQiuNumber.h"
#import "JddDaletouNumber.h"
#import "JddS5F11Number.h"
#import "JddAlertView.h"

@interface JddCommonFunction : NSObject<UIAlertViewDelegate>

+(NSString*)thisDocumentPath;
+(NSString*)binaryFilePath;

+(BOOL)checkNetWork;
+(NSDate*)dateFromString:(NSString*)dateString;
+(id)createObjectFromNibName:(NSString*)nibName;
+(void)messageBoxWithMessage:(NSString*)message;

+(NSString*)dateTimeStringNoSeperator;
+(NSString*)dateTimeStringNormal;
+(NSString*)dateTimeStringNormalFromDate:(NSDate*)date;
+(NSString*)macAddress;
+(UIImage*)scaleToSizeOfImage:(UIImage*)image size:(CGSize)size;
+(NSString*)dateTimeStringFromTickcount:(double)tickcount;

+(void)setWaitingViewHidden:(BOOL)hidden fromController:(UIViewController*)parentController;
+(void)setViewHidden:(BOOL)hidden fromController:(UIViewController*)parentController;
+(void)pushViewController:(UIViewController*)controller navigationController:(UINavigationController*)navigationController;
+(UIFont*)jddFont;

+(NSArray*)sortArray:(NSArray*)array;

+(void)generateball:(JddShuangSeQiuNumber*)number max:(NSInteger)max count:(NSInteger)count;

+ (void)generateRedBallOfShuangSeQiuNumber:(JddShuangSeQiuNumber*)ssqNumber count:(NSInteger)count;
+ (void)generateBlueBallOfShuangSeQiuNumber:(JddShuangSeQiuNumber*)ssqNumber count:(NSInteger)count;
+ (NSInteger)countShuangSeQiuTotalNumber:(NSInteger)redBallAmount blueBallAmount:(NSInteger)blueBallAmount;

+ (void)generateheadBallOfDaLeTouNumber:(JddDaletouNumber*)dltNumber count:(NSInteger)count;
+ (void)generatebackBallOfDaLeTouNumber:(JddDaletouNumber*)dltNumber count:(NSInteger)count;
+ (NSInteger)countDaLeTouTotalNumber:(NSInteger)headBallAmount backBallAmount:(NSInteger)backBallAmount;
+(NSInteger)countS5TotalNumber:(NSInteger)BallAmount playmethod:(NSInteger)playmethod;
+(NSInteger)countSport:(NSInteger)number1 number:(NSInteger) number2;
+ (void)generateBallOf11s5Number:(JddS5F11Number*)s5Number type:(NSInteger)count;
+ (NSInteger)recurseBallNumber:(NSInteger)ballAmount combinationNumber:(NSInteger)combinationNumber;
+ (BOOL)isLogin;
+ (NSString *)convertWeekByNumber:(NSString *)number;
+(NSString *)getOpenEndDateWithEndtime:(NSString *)endTime;
+ (NSString *)getStringDateWithStringDateTime:(NSString *)dateTimeStr;
+(void)paramsWithQXCorPWArray:(NSArray *)ballArrays AndString:(NSMutableString *)lotString;
+(NSAttributedString *)convertHTMLFontRedWithResult :(NSString *)result AndCellLabel :(UILabel *)label;
+(NSString *)getCGByKey:(NSString *)cg;
+(NSString *)dealJCLQSFCWithSfc:(NSString *)sfc;
+(NSString *)getDateTimeWithEndTime:(NSString *)endTime;
+(NSMutableDictionary *)updateBuyLotteryListWithLotteryId:(NSInteger)lotteryId;
+ (NSDate *)NSStringToNSDate:(NSString *)string;
+ (UIImage *)getImgByLevel:(NSString *)level;
+ (int )getTotetherBuyLottIdWithLotteryNameIndex:(int)index;
+ (int )getSportLottIdWithLotteryNameIndex:(int)index;
+ (int )getBaseketBallLottIdWithLotteryNameIndex:(int)index;

+(NSString *)getImgByLotteryId:(NSInteger )lotteryId;
+(NSString *)getNameByLotteryId:(NSInteger )lotteryId;
+(NSInteger)getLotteryIdByName:(NSString *)Name;
+(NSString *)getScoreDateTimeFormString:(NSString *)date;
+ (void)generateBallOf11YDJNumber:(JddS5F11Number*)s5Number type:(NSInteger)type;
+(NSInteger)count11YDJTotalNumber:(NSInteger)BallAmount playmethod:(NSInteger)playmethod;
+ (BOOL)isAliPayUser;
+(void)setViewBackgroundWithImageName:(NSString *)imageName AndView:(UIView *)view;
+(NSString *)getCgWithFangAnCg:(NSString *)cg AndPlayTypeName:(NSString *)playTypeName;
+(NSInteger)getNumberByStrDXDS:(NSString *)str;
+(NSString *)getStrDXDSByNumber:(NSInteger)number;
+(void)clearViewControllers;
+ (int )getBDLottIdWithLotteryNameIndex:(int)index;
+(int)getCountNumberWithNumberArray:(NSMutableArray *)numberArray AndPlayMethodTemp:(NSMutableArray *)playMethodTemp;


/* 调整图片大小 */
+ (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size;
/* url参数分析 */
+ (NSDictionary*)dictionaryFromQuery:(NSString*)query usingEncoding:(NSStringEncoding)encoding;
//! 放大缩小动画 以示突出
+ (void) animationViewWithZoomOutIn:(UIView *)aView delaySecond:(float)delay;

+(BOOL)saveImageToPath:(UIImage *)image withFileName:(NSString *)imageName withPath:(NSString *)path withData:(NSMutableDictionary*)infoDic;
+(NSString *)getBannerFileName:(NSString *)imageName withPath:(NSString *)path;
+(NSMutableDictionary *)getBannerPicUrlPlist;
+(BOOL)savePlistInfo:(NSArray *)arr;
@end

@interface NSString(md5)

-(NSString*)myMd5;
-(NSString*)my32Md5;

@end

@interface NSMutableString(md5)

-(NSString*)myMd5;
-(NSString*)my32Md5;

@end